#!/usr/bin/env node
//console.log(process.argv);
//console.log(process.argv[2],process.argv[3]);
const exp = process.argv[2];
if(exp == '--help'|| exp == '-h'||typeof(exp)=='undefined'){
  help();
}else{
  calc();
}
function help(){
  console.log('usage:cmd-name [OPTION] [expression]\nevaluate the expression.\nMandatory arguments to long options are mandatory for short options too.\n-h, --help output information and exit');

} 
//function calc(){
//console.log(`${exp}=${eval(exp)}`);
//}
function calc(){
  try{
    console.log(`${exp} = ${eval(exp)}`);
  } catch(e){
    console.log(`${exp} 不是合法的数学公式！`);
  }
}
